<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.ResultsShow,java.util.ArrayList,com.ejoysoft.common.Constants,com.ejoysoft.wlanyz.system.SysUserUnit,com.ejoysoft.common.exception.NoRightException" %>
<%@ include file="../include/jsp/head.jsp"%>
<%
if(!globa.userSession.hasRight("10030"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<% 
    //初始化
    ResultsShow  resultsshow=null;
    ResultsShow obj=new ResultsShow(globa);
    //拿到转过来的城市名
    String  strCity = ParamUtil.getString(request,"strCity","");
    //查询条件
    String  strName=ParamUtil.getString(request,"strName","");
    String checked1 =  ParamUtil.getString(request,"checkedFlag","WLAN");
    String  strStartTime = ParamUtil.getString(request,"strStartTime","");
    String  strEndTime = ParamUtil.getString(request,"strEndTime","");
	String tWhere=" where 1 = 1 ";
    if(!strStartTime.equals("")&&!strEndTime.equals("")){
	 if(strStartTime.compareTo(strEndTime)>0)
       {
          out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
        } 
	}
	
	 if(!strCity.equals("")){
     tWhere += " and b.strCity LIKE '%"+ strCity +"%'";
    }
	int tabi = 1;
	
	if(checked1.equals("TD")){
	  tWhere += " and a.strnettype ='TD'  ";
	  tabi = 2;
	}
	else if(checked1.equals("GSM")){
	  tWhere += " and a.strnettype ='GSM' ";
	  tabi = 3;
	}
	else{
	   tWhere += " and a.strnettype ='WLAN' ";
	  tabi = 1;
	}
	 
	//记录总数
	int intAllCount=obj.getCount(tWhere,strStartTime,strEndTime);
	//System.out.println(intAllCount+"+++++++++++++++++++++");
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	int intPageSize=globa.getIntPageSize();
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
	if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<ResultsShow> vctObj=obj.list(tWhere,intStartNum,intPageSize,strStartTime,strEndTime);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
	
	ArrayList<String> cityList = obj.getAllCitiesByName("");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script src="../jquerytable/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script language="javascript">

 function showAc(){
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
 
 function checks1(flag){ 
  frm.action="results_list.jsp";
  if(flag ==0){
     document.getElementById("checkedFlag").value = "WLAN";
  }
  else if(flag ==1){
     document.getElementById("checkedFlag").value = "TD";
  }
  else{
     document.getElementById("checkedFlag").value = "GSM"; 
  }
  frm.submit();
 }
 //分标签显示
function clkOn(num){ 
	var allNum = 3;
	
	for(i=1;i<=allNum;i++)
	{
	$("#tabLabel"+num).attr("class","taba1");
		if(i != num)
		{
			$("#tabLabel"+i).attr("class","taba2");
		} 
	}
}
function xiantu(){
frm.action = "xiantu.jsp";
frm.submit();
}
//导出数据
function export_sbm(page){ 
  frm.action="results_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";//当前页
  document.getElementById("exportContent").value = page;
  frm.submit();
 }

</script>
<style>
.taba1{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
.taba3{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
.taba2{ width:123px; height:27px; background:url(../images/tab_2.jpg); color:#666666; text-align:center;line-height:25px;line-height:26px;  border-right:1px solid #32a4ea; line-height:26px;}

A {text-decoration: NONE} 
</style>
</head>


<body body onload="clkOn(<%=tabi%>);">
<form id=frm name="frm" method=post action="results_list.jsp"> 
<input id="checkedFlag" name="checkedFlag" type="hidden" value="<%=checked1%>"/>
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value=""/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">任务管理</font> &gt; 测试原始结果查看</td>
  </tr>
</table>
<table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" width="30%" height="40">地市(<span class="STYLE1">*</span>)
          <select name="strCity" id="strCity" class="sel1" style="width:100px" >
          <option value="">--请选择--</option>
			 <% for (int j = 0; j <  cityList.size(); j++) {
					String city = cityList.get(j);
					String selected = "";
					if(city !=null){
					if(strCity!= null && strCity.equals(city))
						selected = "selected='selected'";
				%>
				<option value="<%=city%>" <%=selected%>>
					<%=city%>
				</option>
				<%
				}
				}
				%>
          </select></td>
          
           <td align="right" width="50%" >起止时间(<span class="STYLE1">*</span>)
	          <input  name="strStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strStartTime %>"style="width:100"/>-
	          <input  name="strEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strEndTime %>"style="width:100"/>
          </td>
          <td width="%">&nbsp;</td>
        <td><img src="../images/search.jpg" width="58" height="28" onclick="showAc()" style="cursor:hand"/></td>
        <td width="%"><br /></td>
        </tr>
      </table></td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td width="8%"  height="27" background="../images/tab_1.jpg" class="taba1" id="tabLabel1" name="tabLabel1" onclick="clkOn('1');checks1(0)" style="cursor:hand">WLAN指标预警</td>
 <td width="8%"  background="../images/tab_2.jpg" class="taba2" id="tabLabel2" name="tabLabel2" onclick="clkOn('2');checks1(1) " style="cursor:hand">TD指标预警</td>
 <td width="8%"  background="../images/tab_2.jpg" class="taba2" id="tabLabel3" name="tabLabel3" onclick="clkOn('3');checks1(2) " style="cursor:hand">GSM指标预警</td>
 <td >&nbsp;</td>
    </tr>
  <tr>
    
    <td width="8%" class="listtit">地市</td>
    <td width="8%" class="listtit">区县</td>
    <td width="10%" class="listtit">小区名称</td>
    <td width="10%" class="listtit">小区区码</td>
    <td width="10%" class="listtit">小区ID</td>
    <td width="7%" class="listtit">任务类型</td>
    <td width="7%" class="listtit">代维人员</td>
    <td width="7%" class="listtit">测试手机号</td>
    <td width="7%" class="listtit">测试时间</td>
    <td width="10%" class="listtit">查看信息</td>
    
  </tr>
    <%
            
              for (int i = 0;i < vctObj.size(); i++) {
              String city = "";
              String town = "";
              String dtDate = "";//time
              String comname = "";//小区名称
              String Lac = "";//小区区码
              String Ic = "";//小区Id
              String tasktype = "";//任务类型
              String pname = "";//代维人员
              String phone = "";//测试手机号
              
              
		             int value;//指标值
            	ResultsShow obj1 = vctObj.get(i);
            	if(obj1.getStrCity()!=null)city=obj1.getStrCity();
            	if(obj1.getStrTown()!=null)town=obj1.getStrTown();
            	if(obj1.getStrSiteName()!=null)comname=obj1.getStrSiteName();
            	if(obj1.getStrLac()!=null)Lac=obj1.getStrLac();
            	if(obj1.getStrCommunityId()!=null)Ic=obj1.getStrCommunityId();
            	if(obj1.getStrTaskType()!=null)tasktype=obj1.getStrTaskType();
            	if(obj1.getStrTaskMan()!=null) pname=obj1.getStrTaskMan();
            	if(obj1.getStrPhone()!=null) phone=obj1.getStrPhone();
            	if(obj1.getDtCreateDate()!=null) dtDate=obj1.getDtCreateDate();
            	
            %>

  <tr>
    <td class="listd1" style="border-left:1px solid #dddddd;"> <%=city %>&nbsp;</td>
    <td class="listd1"><%=town %>&nbsp;</td>
    <td class="listd1"><%=comname %>&nbsp;</td>
    <td class="listd1"><%=Lac %>&nbsp;</td>
    <td class="listd1"><%=Ic %>&nbsp;</td>
    <td class="listd1"><%=tasktype %>&nbsp;</td>
    <td class="listd1"><%=pname %>&nbsp;</td>
    <td class="listd1"><%=phone %>&nbsp;</td>
    <td class="listd1"><%=dtDate %>&nbsp;</td>
    <td class="listd1" style="border-right:1px solid #dddddd;"><a href="results_index.jsp?strId=<%=obj1.getStrId()%>">查看指标&nbsp;</a>
    <a href="results_picture.jsp?strId=<%=obj1.getStrId()%>">查看图片&nbsp;</a></td>

   </tr>
             <%
            }
            %>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images/pldel.jpg" width="83" height="27" align="middle" />--> &nbsp;&nbsp;页面记录数
      <select name="strPageSize" id="strPageSize" style="width:52px;" onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		 %>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>
   		 </select>
      <img src="../images/dc.jpg" width="92" height="27" align="middle" onclick="export_sbm('currentPage')" style="cursor:hand"/> 
      <img src="../images/dcall.jpg" width="82" height="27" align="middle" onclick="export_sbm('allPage')" style="cursor:hand"/></td>
    <td width="39%" align="right" valign="bottom">            <!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
</table>




 </form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>